package com.cx.controller.lq;

import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpSession;
@Controller
public class ChatController {
    @Autowired
    private WebSocketOneToOne webSocketOneToOne;
    /**     * 登录界面直接聊天     * **/
    @RequestMapping("user_1")
    public String user_1(String usr , HttpSession session){
        session.setAttribute("usr",usr);
        return "user_1";
    }
        /**     * 发送消息 消息内容,发送人,接收人,会话标识     * **/
        @RequestMapping("message")
        public void message(String msg,String from,String to,String socketId){
            webSocketOneToOne.send(msg, from, to, socketId);
        }
}
